import time

from appium import webdriver
from selenium.webdriver.common.by import By

caps = {
    'platformName': 'Android',
    'platformVersion': '5.1.1',
    'deviceName': 'NNN',
    'appPackage': 'com.android.settings',
    'appActivity': '.Settings'
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_capabilities=caps)
# 下拉
# driver.swipe(start_x=200, start_y=200, end_x=200, end_y=300)

# 元素滑动
wait = driver.find_element(By.XPATH, '//*[@text = "WLAN"]')
app = driver.find_element(By.XPATH, '//*[@text = "存储"]')
# 源元素 定位 滑动
# driver.scroll(origin_el=app, destination_el=wait, duration=3000)

# 相对精确的 滑动
driver.drag_and_drop(origin_el=app, destination_el=wait)

time.sleep(2)
driver.quit()
